package com.example.controller;

import com.example.entity.User;
import com.example.reponsitory.UserReponsitory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * <h3>springboot-jpa</h3>
 * <p></p>
 *
 * @author : 你的名字
 * @date : 2020-03-03 10:14
 **/
@RestController
public class UserController {
    @Autowired
    private UserReponsitory userReponsitory;

    @GetMapping("/user/{id}")
    public User getOne(@PathVariable("id") Integer id) {
        User one = userReponsitory.findById(id).orElse(null);
        System.out.println(one);
        return one;
    }
}
